<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        var init = (function () {
            var name = 123;
            function callName() {
                console.log(name)
            }

            return function () {
                callName()
            }
        })()


        var liu = {
            smoke: function () {
                console.log('smoke')
                return this;
            },
            drink: function () {
                console.log('drink')
                return this;
            },
            perm: function () {
                console.log('perm')
                return this;
            }
        }

        liu.smoke().drink().perm()

        var deng = {
            wife1: {
                name: 'xiaoliu1'
            },
            wife2: {
                name: 'xiaoliu2'
            },
            wife3: {
                name: 'xiaoliu3'
            },
            wife4: {
                name: 'xiaoliu4'
            },
            sayWife: function (num) {
                return this['wife' + num]
            }
        }
    </script>
</body>

</html>